---
layout: docs
page_title: CLI
description: >
  The Nomad Autoscaler can be controlled via a command-line interface. This
  page documents all the commands the Nomad Autoscaler accepts.
---

# Nomad Autoscaler Command: agent

The agent command is used to start the Nomad Autoscaler which runs until an
interrupt signal is received. The Nomad Autoscaler agent's configuration
primarily comes from the config files used, but a subset of the options may
also be passed directly as CLI arguments. See the
[Nomad Autoscaler Agent guide][nomad_autoscaler_agent_guide] for more information
on how to use this command and the options it has.

## Command-line Options

A subset of the available Nomad Autoscaler agent configuration can optionally be
passed in via CLI arguments. The `agent` command accepts the following arguments:

- `-config=<path>`: The path to either a single config file or a directory of
  config files to use for configuring the Nomad Autoscaler agent.

- `-log-level=<level>`: Specify the verbosity level of Nomad Autoscaler's logs.
  Valid values include `DEBUG`, `INFO`, and `WARN`, in decreasing order of verbosity.
  The default is `INFO`.

- `-log-json`: Output logs in a JSON format. The default is `false`.

- `-plugin-dir=<path>`: The plugin directory is used to discover Nomad Autoscaler
  plugins. If not specified, the plugin directory defaults to be that of
  `<current-dir>/plugins/`.

- `-http-bind-address=<addr>`: The HTTP address that the health server will bind
  to. The default is `127.0.0.1`.

- `-http-bind-port=<port>`: The port that the health server will bind to. The
  default is `8080`.

- `-enable-debug`: Enable the agent debugging HTTP endpoints. The default is
  false.

- `-nomad-address=<addr>`: The address of the Nomad server in the form of
  `protocol://addr:port`. The default is `http://127.0.0.1:4646`.

- `-nomad-region=<region>`: The region of the Nomad servers to connect with.

- `-nomad-namespace=<namespace>`: The target namespace for queries and actions
  bound to a namespace.

- `-nomad-token=<token>`: The SecretID of an ACL token to use to authenticate
  API requests with.

- `-nomad-http-auth=<username:password>`: The authentication information to use
  when connecting to a Nomad API which is using HTTP authentication.

- `-nomad-ca-cert=<path>`: Path to a PEM encoded CA cert file to use to verify
  the Nomad server SSL certificate.

- `-nomad-ca-path=<path>`: Path to a directory of PEM encoded CA cert files to
  verify the Nomad server SSL certificate. If both `-nomad-ca-cert` and
  `-nomad-ca-path` are specified, `-nomad-ca-cert` is used.

- `-nomad-client-cert=<path>`: Path to a PEM encoded client certificate for TLS
  authentication to the Nomad server. Must also specify `-nomad-client-key`.

- `-nomad-client-key=<path>`: Path to an unencrypted PEM encoded private key
  matching the client certificate from `-nomad-client-cert`.

- `-nomad-tls-server-name=<name>`: The server name to use as the SNI host when
  connecting via TLS.

- `-nomad-skip-verify`: Do not verify TLS certificates. This is strongly discouraged.

- `-nomad-block-query-wait-time=<dur>`: How long applicable Nomad API requests
  supporting blocking queries are held open. Defaults to `5m`.

- `-policy-dir=<path>`: The path to a directory used to load scaling policies.

- `-policy-default-cooldown=<dur>`: The default cooldown that will be applied to
  all scaling policies which do not specify a cooldown period. The default is `5m`.

- `-policy-default-evaluation-interval=<dur>`: The default evaluation interval
  that will be applied to all scaling policies which do not specify an evaluation
  interval. The default is `10s`.

- `-policy-eval-ack-timeout=<dur>`: The time limit that an eval must be ACK'd before
  being considered NACK'd.

- `-policy-eval-delivery-limit=<num>`: The maximum number of times a policy
  evaluation can be dequeued from the broker.

- `-policy-eval-workers=<key:value>`: The number of workers to initialize for each
  queue, formatted as `<queue1>:<num>,<queue2>:<num>`. Nomad Autoscaler supports
  `cluster` and `horizontal` queues. Nomad Autoscaler Enterprise supports additional
  `vertical_mem` and `vertical_cpu` queues.

- `-policy-source-disable-file`: Disable the sourcing of policies from disk.

- `-policy-source-disable-nomad`: Disable the sourcing of policies from the
  Nomad API.

- `-telemetry-disable-hostname`: Specifies whether gauge values should be prefixed
  with the local hostname.

- `-telemetry-enable-hostname-label`: Enable adding hostname to metric labels.

- `-telemetry-collection-interval=<dur>`: Specifies the time interval at which
  the agent collects telemetry data. The default is 1s.

- `-telemetry-statsite-address=<addr>`: The address of the statsite aggregation
  server.

- `-telemetry-statsd-address=<addr>`: The address of the statsd aggregation.

- `-telemetry-dogstatsd-address=<addr>`: The address of the Datadog statsd server.

- `-telemetry-dogstatsd-tag=<tag_list>`: A list of global tags that will be added
  to all telemetry packets sent to DogStatsD.

- `-telemetry-prometheus-metrics`: Indicates whether the agent should make Prometheus
  formatted metrics available. Defaults to `false`.

- `-telemetry-prometheus-retention-time=<dur>`: The time to retain Prometheus
  metrics before they are expired and untracked.

- `-telemetry-circonus-api-token`: A valid API Token used to create/manage check.
  If provided, metric management is enabled.

- `-telemetry-circonus-api-app`: The app name associated with API token. Defaults
  to `nomad_autoscaler`.

- `-telemetry-circonus-api-url`: The base URL to use for contacting the Circonus
  API. Defaults to `https://api.circonus.com/v2`.

- `-telemetry-circonus-submission-interval`: The interval at which metrics are
  submitted to Circonus. Defaults to `10s`.

- `-telemetry-circonus-submission-url`: The check.config.submission_url field
  from a previously created HTTPTrap check.

- `-telemetry-circonus-check-id`: The check id from a previously created HTTPTRAP
  check. The numeric portion of the check.\_cid field.

- `-telemetry-circonus-check-force-metric-activation`: Force enabling metrics,
  as they are encountered, if the metric already exists and is NOT active. If
  check management is enabled, the default behavior is to add new metrics as
  they are encountered.

- `-telemetry-circonus-check-instance-id`: Uniquely identify the metrics coming
  from this agent. Defaults to `hostname:app`.

- `-telemetry-circonus-check-search-tag`: A special tag that helps to narrow
  down the search results when neither a submission URL or check ID are provided.
  Defaults to `service:app`.

- `-telemetry-circonus-check-tags`: A comma separated list of tags to apply to
  the check. The value of `-telemetry-circonus-check-search-tag` will always be
  added to the check.

- `-telemetry-circonus-check-display-name`: The name used for the Circonus check
  that will be displayed in the UI. This defaults to the value of
  `-telemetry-circonus-check-instance-id`.

- `-telemetry-circonus-broker-id`: The Circonus broker to use when creating a
  new check.

- `-telemetry-circonus-broker-select-tag`: A tag which is used to select a broker
  ID when an explicit broker ID is not provided.

- `-high-availability-enabled`: Specifies whether the Nomad Autoscaler agent will
  start in high availability mode. If enabled, the agent instance attempts to
  hold a lock over a Nomad variable and will only execute if the lock is
  successfully acquired. It defaults to `false`.

- `-high-availability-lock-namepsace`: Defines the path of the Nomad namespace
  where the variable that will be used to sync the leader when running in high
  availability mode. This parameter needs to be the same on all Nomad
  Autoscaler agents expected to take part in the same leadership election
  process. Defaults to `default`.

- `-high-availability-lock-path`: Defines the path of the Nomad variable that
  will be used to sync the leader when running in high availability mode. This
  parameter needs to be the same on all Nomad Autoscaler agents expected to
  take part in the same leadership election process. Defaults to
  `nomad-autoscaler/lock`.

- `-high-availability-lock-ttl`: Defines the lease period or TTL of the lock used
  to sync the leader when running on high availability mode. If the Nomad
  Autoscaler agent does not renew the lock within this period, the lock is
  considered lost. Defaults to `60s`.

- `-high-availability-lock-delay`: Defines the period that the lock will be
  blocked after the TTL expired without being renewed. This helps prevent split
  brain situations. Defaults to `30s`.

# Nomad Autoscaler Command: version

The `version` command displays build information about the running binary,
including the release version and the exact revision.

## Usage

```plaintext
nomad-autoscaler version
```

## Output

This command prints both the version number as well as the exact commit SHA used
during the build. The SHA may also have the string `+CHANGES` appended to the
end, indicating that local, uncommitted changes were detected at build time.

## Examples

```shell-session
$ nomad-autoscaler version
Nomad Autoscaler v0.0.3-dev (da91fa9)
```

[nomad_autoscaler_agent_guide]: /nomad/tools/autoscaling/agent
